package com.akkainaction.router.group.actor.scattergatherfirstcompleted;

import akka.actor.ActorRef;
import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.routing.FromConfig;

public class MasterFirstActor extends UntypedActor {

    private ActorRef router;

    @Override
    public void preStart() throws Exception {
        getContext().actorOf(Props.create(FCActor1.class), "fcActor1");
        getContext().actorOf(Props.create(FCActor2.class), "fcActor2");
        router = getContext().actorOf(FromConfig.getInstance().props(), "router");
    }

    @Override
    public void onReceive(Object msg) throws Exception {
        router.tell(msg, getSender());
    }
}
